<template>
	<view style="padding: 30rpx;overflow: hidden;">
		<sku-popup ref="skuPopup" :sku-data="skuData" @sku-str="onSkuStr" @sku-ready="onSkuReady" @buy-now="onBuyNow" @add-cart="onAddCart"></sku-popup>
		<view @click="open">{{ skuStr }}</view>
	</view>
</template>

<script>
import SkuPopup from '../components/sku-popup/sku-popup.vue';
	export default {
		options: { styleIsolation: 'shared' },
		components: {
			SkuPopup,
		},
		data() {
			return {
				skuData: {
					productImg: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Fb5dfe773-626f-45a3-af9a-33936bbbd0c0%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1736933733&t=435edf257ddaa1b3355f5ffd3c427f1e',
					productPrice: 299,
					combs: [
						{
							comb: '100,104,107',
							combName: '深红色,鸭羽绒,M码',
							skuId: 200,
							skuPrice: 99,
							skuNum: 10,
							skuImg: 'https://b0.bdstatic.com/cd01bba74a56a0ff2b1217a22757fb73.jpg@h_1280',
						},
						{
							comb: '100,105,106',
							combName: '深红色,鹅羽绒,S码',
							skuId: 201,
							skuPrice: 69,
							skuNum: 8,
							skuImg: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Ff095b514-d6ca-4512-b7ec-480a157ffc5d%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1736933733&t=87bd3279a1e8ce2698c2c22c17f93a11'
						},
						{
							comb: '101,103,108',
							combName: '浅蓝色,纯棉服,L码',
							skuId: 202,
							skuPrice: 79,
							skuNum: 1,
							skuImg: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Fb4b1529a-3fe9-4431-9fca-a278788e871e%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1736933733&t=b3da214087b1008ecaf89d49ea8efdd3',
						},
						{
							comb: '102,104,109',
							combName: '明黄色,鸭羽绒,XL码',
							skuId: 203,
							skuPrice: 199,
							skuNum: 6,
							skuImg: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Fb3f52ffe-a02d-480f-9e91-f99e0e89af0d%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1736933733&t=84e5415f6a68dba4b045a3b2c223834b',
						},
					],
					skuKeys:[
						{
							keyId: 1,
							keyName: '颜色',
							skuValues: [
								{
									valueId: 100,
									valueName: '深红色'
								},
								{
									valueId: 101,
									valueName: '浅蓝色'
								},
								{
									valueId: 102,
									valueName: '明黄色'
								},
								{
									valueId: 111,
									valueName: '藏蓝色'
								},
								{
									valueId: 112,
									valueName: '深棕色'
								},
							]
						},
						{
							keyId: 2,
							keyName: '质地',
							skuValues: [
								{
									valueId: 103,
									valueName: '纯棉服'
								},
								{
									valueId: 104,
									valueName: '鸭羽绒'
								},
								{
									valueId: 105,
									valueName: '鹅羽绒'
								},
							]
						},
						{
							keyId: 3,
							keyName: '尺码',
							skuValues: [
								{
									valueId: 106,
									valueName: 'S码'
								},
								{
									valueId: 107,
									valueName: 'M码'
								},
								{
									valueId: 108,
									valueName: 'L码'
								},
								{
									valueId: 109,
									valueName: 'XL码'
								},
							]
						},
					]
				},
				skuStr: '请选择规格'
			}
		},
		onLoad() {

		},
		methods: {
			open() {
				this.$refs.skuPopup.open()				
			},
			onSkuStr(skuStr) {
				this.skuStr = skuStr
			},
			onSkuReady(skuObj) {
				console.log('skuObj',skuObj);
			},
			onBuyNow(params) {
				console.log('onBuyNow',params);
			},
			onAddCart(params) {
				console.log('onAddCart',params);
			}
		}
	}
</script>

<style>
	::v-deep .uni-popup__wrapper-box {
  background-color: white;
	border-radius: 20px 20px 0 0;
}
</style>
